﻿

using System.Windows;
using System;
namespace DeepEarth.Toolkit.Geometry.Templates
{
    public static class TemplateHelper
    {
        const string PUSHPIN = "PushpinTemplate";
        const string LINESTRING = "LineStringTemplate";
        const string POLYGON = "PolygonTemplate";
        const string LABEL = "LabelTemplate";

        private static ResourceDictionary LoadResourceDictionary()
        {
            ResourceDictionary rd = new ResourceDictionary();
            rd.Source = new Uri("/DeepEarth.Toolkit.Geometry;component/Templates/DefaultTemplates.xaml", UriKind.Relative);

            return rd;
        }

        private static DataTemplate GetTemplate(string resourceKey)
        {
            ResourceDictionary rd = LoadResourceDictionary();

            return rd[resourceKey] as DataTemplate;
        }

        public static DataTemplate GetPushpinTemplate()
        {
            return GetTemplate(PUSHPIN);
        }

        public static DataTemplate GetLineStringTemplate()
        {
            return GetTemplate(LINESTRING);
        }

        public static DataTemplate GetPolygonTemplate()
        {
            return GetTemplate(POLYGON);
        }

        public static DataTemplate GetLabelTemplate()
        {
            return GetTemplate(LABEL);
        }
    }
}
